// Copyright Epic Games, Inc. All Rights Reserved.

#include "SHotPakerSettings.h"

#include "EditorStyleSet.h"
#include "Styling/CoreStyle.h"
#include "Framework/MultiBox/MultiBoxBuilder.h"
#include "Framework/MultiBox/MultiBoxDefs.h"
#include "SlateOptMacros.h"
#include "Widgets/SBoxPanel.h"
#include "Widgets/Layout/SBorder.h"
#include "Widgets/Layout/SGridPanel.h"
#include "Widgets/Layout/SSeparator.h"
#include "Widgets/Text/STextBlock.h"
#include "Widgets/Layout/SScrollBox.h"
#include "Widgets/Text/SInlineEditableTextBlock.h"

#include "Models/HotPakerModel.h"
#include "Widgets/Cook/SHotPakerCookPage.h"
#include "Widgets/Package/SHotPakerPackagePage.h"


#define LOCTEXT_NAMESPACE "SHotPakerSettings"


/* SHotPakerSettings structors
 *****************************************************************************/

SHotPakerSettings::SHotPakerSettings()
{ }


SHotPakerSettings::~SHotPakerSettings()
{
}


/* SHotPakerSettings interface
 *****************************************************************************/

BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SHotPakerSettings::Construct(const FArguments& InArgs, const TSharedRef<FHotPakerModel>& InModel)
{
	Model = InModel;

	OnCloseClicked = InArgs._OnCloseClicked;

	ChildSlot
	[
		SNew(SVerticalBox)

		+SVerticalBox::Slot()
		.FillHeight(1.0f)
		.Padding(2.0f)
		[
			SNew(SScrollBox)

			+ SScrollBox::Slot()
			.Padding(0.0f, 0.0f, 8.0f, 0.0f)
			[
				SNew(SGridPanel)
				.FillColumn(1, 1.0f)

				// cook section
				+ SGridPanel::Slot(0, 0)
				.ColumnSpan(2)
				.Padding(0.0f, 16.0f)
				[
					SNew(SSeparator)
					.Orientation(Orient_Horizontal)
				]

				+ SGridPanel::Slot(0, 1)
				.Padding(8.0f, 0.0f, 0.0f, 0.0f)
				.VAlign(VAlign_Top)
				[
					SNew(STextBlock)
					.Font(FCoreStyle::GetDefaultFontStyle("Bold", 13))
					.Text(LOCTEXT("CookSectionHeader", "Cook"))
				]

				+ SGridPanel::Slot(1, 1)
				.Padding(32.0f, 0.0f, 8.0f, 0.0f)
				[
					SNew(SHotPakerCookPage, InModel)
				]

				// package section
				+ SGridPanel::Slot(0, 2)
					.ColumnSpan(2)
					.Padding(0.0f, 16.0f)
					[
						SNew(SSeparator)
						.Orientation(Orient_Horizontal)
					]

				+ SGridPanel::Slot(0, 3)
					.Padding(8.0f, 0.0f, 0.0f, 0.0f)
					.VAlign(VAlign_Top)
					[
						SNew(STextBlock)
						.Font(FCoreStyle::GetDefaultFontStyle("Bold", 13))
					.Text(LOCTEXT("PackageSectionHeader", "Package"))
					]

				+ SGridPanel::Slot(1, 3)
					.Padding(32.0f, 0.0f, 8.0f, 0.0f)
					[
						SNew(SHotPakerPackagePage, InModel)
					]

			]
		]
	];
}
END_SLATE_FUNCTION_BUILD_OPTIMIZATION


void SHotPakerSettings::EnterEditMode()
{
	if (NameEditBox.IsValid())
	{
		NameEditBox->EnterEditingMode();
	}
}






#undef LOCTEXT_NAMESPACE
